package fitness;

import java.util.ArrayList;

public class JankenponResult extends FitnessResult {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public ArrayList<EloRecord> results = new ArrayList<EloRecord>();
	
	@Override
	public Double[] getDecomposition() {
		Double[] res = new Double[results.size()];
		
		for(int i=0; i< results.size(); i++){
			if(results.get(i)!=null)
				res[i] = results.get(i).opponentElo;
			
		}
		return res;	
		}

	@Override
	public double finalResult() {
		double total = 0.0;
		for(EloRecord score: results){
			if(score != null){
			total += score.opponentElo;
			} else {
				System.out.println("Needs some debug");
			}
		}
		return Math.max(0, total-15);
	}

	public void addResult(EloRecord eloRecord) {
		
		if(eloRecord.opponentElo > 10){
			System.out.println("Strange");
		}
		this.results.add(eloRecord);
	}
	
	
	@Override
	public Object clone(){
		JankenponResult res = new JankenponResult();
		res.results = (ArrayList<EloRecord>) this.results.clone();
		return res;
	}

	@Override
	public boolean goodSolution() {
		// TODO Auto-generated method stub
		return false;
	}
}
